<template>
  <div class="contain">
    <div class="top-nav">
      <div class="logo">公司Logo</div>
      <van-search v-model="value" shape="round" class="search-bar" placeholder="搜索内容" @search="onSearch" />
      <div>
        <van-image class="message-icon" round cover :src="userInfoVo.avatar" />
      </div>
    </div>

    <userInfo />
    <homeGrid />
    <newsSection :title="AnnouncementsSection.title" :items="AnnouncementsSection.items" />

    <homeSection type="activity" :title="HotActivitiesSection.title" :items="HotActivitiesSection.items" />
    <homeSection type="welfare" :title="WelfarePreviewSection.title" :items="WelfarePreviewSection.items" />
    <homeSection type="Messages" :title="MessagesSection.title" :items="MessagesSection.items" />
    <Tabbar />
  </div>
</template>
<script setup>
import { ref } from 'vue'
import userInfo from '@/components/layout/userInfo.vue'
import homeGrid from '@/components/layout/homeGrid.vue'
import homeSection from '@/components/layout/homeSection.vue'
import { showToast } from 'vant'
import { userInfoVo } from '@/config/userInfo'
import newsSection from '@/components/layout/newsSection.vue'
import { AnnouncementsSection, HotActivitiesSection, WelfarePreviewSection, MessagesSection } from '@/config/section'


// const t = () => {
//   const text = '加载中'
//   const obj = Loading.show(text)
//   setTimeout(() => {
//     obj.message = '加载完毕'
//   }, 2000)
//   setTimeout(() => {
//     Loading.hide()
//   }, 3000)
// }
const value = ref('');
const onSearch = (val) => showToast(val);
// const onClickButton = () => showToast(value.value);
</script>



<style>
.container {
  width: 100%;
  max-width: 480px;
  background-color: #ffffff;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  height: 100px;
}

.logo {
  font-size: 30px;
  font-weight: bold;
  color: #374151;
}

.search-bar {
  flex: 1;
  margin: 0 10px;
  padding: 8px;
  border-radius: 8px;
  font-size: 18px;
  color: #ffffff;
}

.message-icon {
  width: 50px;
  height: 50px;
  background-color: #e5e7eb;
  border-radius: 50%;
  position: relative;
}

.message-icon::after {
  content: "";
  width: 8px;
  height: 8px;
  background-color: red;
  border-radius: 50%;
  position: absolute;
  top: 0;
  right: 0;
}

/* User information section */
</style>
